extends layout
block cssjs
    link(rel='stylesheet', href='/css/register.css')
    script(type="text/javascript", src="/js/jquery.md5.js")
    script(type="text/javascript").
        function check() {
            var userID = $('#userID').val().trim();
            var pwd = $('#password').val();
            var repeat = $('#repeat').val();
            var email = $('#email').val().trim();
            if (pwd != repeat) {
                alert('两次密码不同');
                return false;
            }
            var reg = /^[A-Za-z0-9]+$/;
            if (!reg.test(userID)) {
                alert('用户名必须是字母和数字');
                return false;
            }
            if (!reg.test(pwd)) {
                alert('密码必须是字母和数字');
                return false;
            }
            if (!isEmail(email)) {
                alert('邮箱不正确');
                return false;
            }
            $('#userID').val(userID);
            $('#password').val($.md5(pwd));
            $('#repeat').val($.md5(pwd));
            $('#email').val(email);
            $('#fr').val(getQueryString('fr'));
            return true;
        }
block content
    form.form-signin(role='form', id='registerform' name='registerform', action='/doRegister' onsubmit='javascript: return check()')
        h4.form-signin-heading 请填写:
        input(type='text', id='userID' name='userID', class='form-control', placeholder='用户名', required autofocus)
        input(type='password', id='password' name='password', class='form-control', placeholder='密码', required)
        input(type='password', id = 'repeat' name = 'repeat', class='form-control', placeholder='确认密码', required)
        input(type='text', id = 'nick' name='nick', class='form-control', placeholder='昵称', required)
        input(type='email', id = 'email' name='email', class='form-control', placeholder='邮箱', required)
        input(type='text', id='fr' name='fr', class='hide')
        button(type='submit', class='btn btn-lg btn-primary btn-block') 注册